vignettes/displaying-surfaces.Rmd
displaying-surfaces.Rmd
white_surf <- read_surf(white_lh_asc)
#> loading /Users/bbuchsbaum/code/neurosurf/inst/extdata/std.8_lh.smoothwm.asc
white_rh_surf <- read_surf(white_rh_asc)
#> loading /Users/bbuchsbaum/code/neurosurf/inst/extdata/std.8_rh.smoothwm.asc
open3d()
#> glX
#> 1
layout3d(matrix(1:4, 2,2), heights=c(1,3))
t1 <- text3d(0,0,0,"taubin smooth, lambda=.8"); next3d()
white_surf1 <- smooth(white_surf, type="taubin", lambda=.8)
p1 <- plot(white_surf1); next3d()
t2 <- text3d(0,0,0,"HCLaplace smooth, delta=.2, iteration=5"); next3d()
white_surf2 <- smooth(white_surf, type="HCLaplace", delta=.2, iteration=5)
p2 <- plot(white_surf2)
rglwidget()Here we add a colors to the surface that are a function of each surface node’s x coordinate. When then map these values to a rainbow color map.
white_surf1 <- smooth(white_surf, type="taubin", lambda=.9)
open3d()
#> glX
#> 5
mfrow3d(1, 3, byrow = TRUE)
vals <- rnorm(length(nodes(white_surf1)))
surf <- NeuroSurface(white_surf1, indices=1:length(vals), data=vals)
ssurf <- smooth(smooth(surf))
p <- plot(ssurf@geometry, vals=ssurf@data, cmap=rainbow(100), irange=c(-2,2), thresh=c(-.2, .2))
next3d()
comp <- conn_comp(ssurf, threshold=c(-.2,.2))
vals <- ssurf@data
vals[comp$size@data < 5] <- 0
p2 <- plot(ssurf@geometry, vals=vals, cmap=rainbow(100), irange=c(-2,2), thresh=c(-.2, .2))
next3d()
csurf <- cluster_threshold(ssurf, size=33, threshold=c(-.2,.2))
p2 <- plot(csurf, cmap=rainbow(100), irange=c(-2,2), thresh=c(-.2, .2))
rglwidget()
open3d()
#> glX
#> 7
white_surf1 <- smooth(white_surf, type="taubin", lambda=.5)
curv_lh <- curvature(white_surf1)
white_rh_surf1 <- smooth(white_rh_surf, type="taubin", lambda=.5)
curv_rh <- curvature(white_rh_surf1)
p <- plot(white_surf1, bgcol=curv_cols(curv_lh), viewpoint="posterior")
p <- plot(white_rh_surf1,bgcol=curv_cols(curv_rh), viewpoint="posterior")
rglwidget()